--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[



]]--
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---
    local function key_event_fn(inst,key)

        if TUNING.HUTAO_FNS:IsKeyPressed(TUNING["hutao.Config"].GETTING_INTO_THE_RUNNING,key) then
            inst:PushEvent("hutao_hotkey_event.GETTING_INTO_THE_RUNNING",{
                tarpos = TheInput:GetWorldPosition(),
            })
            return
        end
        if TUNING.HUTAO_FNS:IsKeyPressed(TUNING["hutao.Config"].BUTTERFLY_S_EMBRACE,key) then
            inst:PushEvent("hutao_hotkey_event.BUTTERFLY_S_EMBRACE",{
                tarpos = TheInput:GetWorldPosition(),
            })
            return
        end

    end
    local function hotkey_listener_install(inst)
        ---------- 添加键盘监控
        local __key_handler = TheInput:AddKeyHandler(function(key,down)  ------ 30FPS 轮询，不要过于复杂
            if down == false then
                -- print("key_up",key)
                key_event_fn(ThePlayer,key)
            end
        end)
        ---------- 角色删除的时候顺便移除监听。避免切角色的时候出问题
        inst:ListenForEvent("onremove",function()
            __key_handler:Remove()
        end)
    end
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

return function(inst)
    inst:DoTaskInTime(0,function()
        if inst == ThePlayer and inst.HUD and TheInput and TheFocalPoint then
            hotkey_listener_install(inst)
        end
    end)
end